<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Spring Actuator 技术解析 | 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        .header-font {
            font-family: 'Noto Serif SC', serif;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .feature-icon {
            font-size: 2.5rem;
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }
        .drop-cap:first-letter {
            font-size: 3.5em;
            float: left;
            line-height: 0.85;
            margin: 0.1em 0.15em 0 0;
            color: #6e8efb;
            font-weight: 700;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-6xl px-4">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl font-bold mb-6 header-font">Spring Actuator</h1>
                    <p class="text-xl mb-8 opacity-90">Spring Boot 的应用程序监控与管理利器</p>
                    <div class="bg-white bg-opacity-20 p-6 rounded-lg">
                        <p class="drop-cap">Spring Actuator 是 Spring Boot 提供的一组内置工具和功能，用于监控和管理 Spring Boot 应用程序。它为开发者提供了应用程序的运行时信息，如健康状况、指标、日志、环境属性等，通过简单的配置，Actuator 可以暴露各种端点供运维人员、开发人员、或者自动化工具使用。</p>
                    </div>
                </div>
                <div class="md:w-1/2 flex justify-center">
                    <div class="w-full max-w-md">
                        <div class="mermaid">
                            graph LR
                            A[Spring Actuator] --> B(健康检查)
                            A --> C(指标监控)
                            A --> D(环境信息)
                            A --> E(日志管理)
                            A --> F(线程信息)
                            A --> G(应用信息)
                            A --> H(请求跟踪)
                            A --> I(数据库迁移)
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-6xl px-4 py-16">
        <!-- Features Section -->
        <section class="mb-20">
            <h2 class="text-3xl font-bold mb-12 text-center header-font">Spring Actuator 提供的主要功能</h2>
            <div class="grid md:grid-cols-2 lg:grid-cols-4 gap-8">
                <!-- Feature 1 -->
                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="text-center mb-4">
                        <i class="fas fa-heartbeat feature-icon"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-center header-font">健康检查</h3>
                    <p class="text-gray-700">提供应用程序各个部分（如数据库、消息队列等）的健康状态，通常用于监控应用是否正常运行。</p>
                </div>
                
                <!-- Feature 2 -->
                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="text-center mb-4">
                        <i class="fas fa-chart-line feature-icon"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-center header-font">指标监控</h3>
                    <p class="text-gray-700">收集并暴露应用程序运行时的各种指标数据，如内存使用、CPU 使用、HTTP 请求次数等，这些数据可以用来分析应用的性能。</p>
                </div>
                
                <!-- Feature 3 -->
                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="text-center mb-4">
                        <i class="fas fa-cogs feature-icon"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-center header-font">环境信息</h3>
                    <p class="text-gray-700">暴露应用程序的配置信息，包括系统属性、环境变量、配置文件属性等，帮助开发人员快速定位配置问题。</p>
                </div>
                
                <!-- Feature 4 -->
                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="text-center mb-4">
                        <i class="fas fa-scroll feature-icon"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-center header-font">日志级别管理</h3>
                    <p class="text-gray-700">允许动态地查看和修改应用程序中日志的级别，以便在生产环境中更好地调试问题。</p>
                </div>
            </div>
            
            <div class="grid md:grid-cols-2 lg:grid-cols-4 gap-8 mt-8">
                <!-- Feature 5 -->
                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="text-center mb-4">
                        <i class="fas fa-code-branch feature-icon"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-center header-font">线程信息</h3>
                    <p class="text-gray-700">可以获取应用程序当前所有线程的运行状态，帮助诊断线程死锁、线程池耗尽等问题。</p>
                </div>
                
                <!-- Feature 6 -->
                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="text-center mb-4">
                        <i class="fas fa-info-circle feature-icon"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-center header-font">应用程序信息</h3>
                    <p class="text-gray-700">提供应用程序的基本信息，如版本号、描述等。</p>
                </div>
                
                <!-- Feature 7 -->
                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="text-center mb-4">
                        <i class="fas fa-exchange-alt feature-icon"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-center header-font">请求跟踪</h3>
                    <p class="text-gray-700">跟踪和显示 HTTP 请求的详细信息，包括请求和响应的头信息、执行时间等，用于分析 HTTP 请求的性能问题。</p>
                </div>
                
                <!-- Feature 8 -->
                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="text-center mb-4">
                        <i class="fas fa-database feature-icon"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-center header-font">数据库迁移信息</h3>
                    <p class="text-gray-700">显示并管理应用中数据库的迁移状态。</p>
                </div>
            </div>
        </section>
        
        <!-- Advantages Section -->
        <section>
            <h2 class="text-3xl font-bold mb-12 text-center header-font">Spring Actuator 的优势</h2>
            <div class="bg-white rounded-xl shadow-md overflow-hidden">
                <div class="p-8">
                    <div class="space-y-6">
                        <!-- Advantage 1 -->
                        <div class="flex items-start">
                            <div class="flex-shrink-0 bg-blue-100 rounded-full p-3 mr-4">
                                <i class="fas fa-check-circle text-blue-600 text-xl"></i>
                            </div>
                            <div>
                                <h3 class="text-xl font-bold mb-2 header-font">简化监控和管理</h3>
                                <p class="text-gray-700">Actuator 集成了应用程序的监控与管理功能，无需额外开发。开发者可以轻松获取应用的健康状态、性能指标等关键数据，帮助快速发现和解决问题。</p>
                            </div>
                        </div>
                        
                        <!-- Advantage 2 -->
                        <div class="flex items-start">
                            <div class="flex-shrink-0 bg-purple-100 rounded-full p-3 mr-4">
                                <i class="fas fa-puzzle-piece text-purple-600 text-xl"></i>
                            </div>
                            <div>
                                <h3 class="text-xl font-bold mb-2 header-font">与 Spring Boot 无缝集成</h3>
                                <p class="text-gray-700">Actuator 是 Spring Boot 原生支持的一部分，配置和使用极其简单，默认情况下提供了很多有用的端点，开发者只需稍作配置即可。</p>
                            </div>
                        </div>
                        
                        <!-- Advantage 3 -->
                        <div class="flex items-start">
                            <div class="flex-shrink-0 bg-indigo-100 rounded-full p-3 mr-4">
                                <i class="fas fa-sliders-h text-indigo-600 text-xl"></i>
                            </div>
                            <div>
                                <h3 class="text-xl font-bold mb-2 header-font">支持自定义扩展</h3>
                                <p class="text-gray-700">Actuator 允许开发者根据应用需求扩展和定制化，比如创建自定义的健康检查或指标，灵活性非常高。</p>
                            </div>
                        </div>
                        
                        <!-- Advantage 4 -->
                        <div class="flex items-start">
                            <div class="flex-shrink-0 bg-green-100 rounded-full p-3 mr-4">
                                <i class="fas fa-plug text-green-600 text-xl"></i>
                            </div>
                            <div>
                                <h3 class="text-xl font-bold mb-2 header-font">与外部监控工具集成</h3>
                                <p class="text-gray-700">Actuator 可以与 Prometheus、Grafana、Elastic Stack 等流行的监控工具无缝集成，通过标准化的指标和健康检查暴露机制，简化了监控系统的接入。</p>
                            </div>
                        </div>
                        
                        <!-- Advantage 5 -->
                        <div class="flex items-start">
                            <div class="flex-shrink-0 bg-red-100 rounded-full p-3 mr-4">
                                <i class="fas fa-lock text-red-600 text-xl"></i>
                            </div>
                            <div>
                                <h3 class="text-xl font-bold mb-2 header-font">安全性</h3>
                                <p class="text-gray-700">Actuator 支持对不同端点进行安全配置，比如通过 Spring Security 限制某些敏感端点的访问权限，确保应用的安全性。</p>
                            </div>
                        </div>
                        
                        <!-- Advantage 6 -->
                        <div class="flex items-start">
                            <div class="flex-shrink-0 bg-yellow-100 rounded-full p-3 mr-4">
                                <i class="fas fa-rocket text-yellow-600 text-xl"></i>
                            </div>
                            <div>
                                <h3 class="text-xl font-bold mb-2 header-font">生产就绪特性</h3>
                                <p class="text-gray-700">Actuator 提供的功能特别适合生产环境使用，帮助开发人员和运维人员更好地监控和管理应用，提升应用的可靠性和可维护性。</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-8">
        <div class="container mx-auto max-w-6xl px-4 text-center">
            <p class="mb-2">技术小馆</p>
            <a href="http://www.yuque.com/jtostring" class="text-blue-400 hover:text-blue-300 transition-colors duration-200">http://www.yuque.com/jtostring</a>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            },
            themeCSS: `
                .node rect {
                    fill: #ffffff;
                    stroke: #6e8efb;
                    stroke-width: 2px;
                }
                .node text {
                    fill: #333333;
                    font-family: 'Noto Sans SC', sans-serif;
                }
                .edgePath path {
                    stroke: #a777e3;
                    stroke-width: 2px;
                }
            `
        });
        
        // Add smooth scrolling to all links
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>